<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <title>WMSLayer - 4.6</title>

    <style>
        html,
        body,
        #viewDiv {
            padding: 0;
            margin: 0;
            height: 100%;
            width: 100%;
        }
    </style>

    <link rel="stylesheet" href="https://js.arcgis.com/4.6/esri/css/main.css">
    <script src="https://js.arcgis.com/4.6/"></script>

    <script>
        require([
            "esri/config",
            "esri/Map",
            "esri/views/SceneView",
            "esri/layers/WMSLayer",
            "dojo/domReady!"
        ], function (
            esriConfig,
            Map,
            SceneView,
            WMSLayer
        ) {

                // Use a proxy for the initial WMS GetCapabilities request if the WMS server is not enabled for CORS
                // esriConfig.request.proxyUrl  = "/proxy/";

                esriConfig.request.corsEnabledServers.push("ows.terrestris.de");

                var layer = new WMSLayer({
                    url: "https://ows.terrestris.de/osm/service",
                    sublayers: [{
                        name: "OSM-WMS"
                    }]
                });

                var map = new Map({
                    basemap: {
                        baseLayers: [layer]
                    }
                });

                var view = new SceneView({
                    container: "viewDiv",
                    map: map
                });

            });
    </script>

</head>

<body>
    <div id="viewDiv"></div>
</body>

</html>